<template>
	<view>
		发货
	</view>
</template>

<script>
	export default {
		onLoad(e) {
			wx.openBluetoothAdapter({
				success(res) {
					console.log('00' + JSON.stringify(res))
					wx.startBluetoothDevicesDiscovery({
						services: ['FFF0'],
						success(res) {
							console.log('2' + JSON.stringify(res))
							wx.onBluetoothDeviceFound((res) => {
								res.devices.forEach(device => {
									if (!device.name && !device.localName) {
										return
									}
									console.log('for循环:', JSON.stringify(device))

									wx.createBLEConnection({
										deviceId: device.deviceId,
										success: () => {
													console.log('连接成功:', JSON.stringify(device))
											// 连接成功，获取服务
											wx.getBLEDeviceServices({
												deviceId: device
													.deviceId,
											})
										}
									})

								})
							})
						},
						complete(res) {
							console.log('3' + JSON.stringify(res))
						},
						fail(res) {
							console.log('4' + JSON.stringify(res))
						}
					})
				}
			})

		},
		data() {
			return {

			};
		}
	}
</script>

<style lang="scss">

</style>